<!--$Id: dbc_dup.so,v 10.34 2007/10/24 16:06:07 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DBcursor-&gt;dup</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DBcursor-&gt;dup</b>
</td>
<td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db.h&gt;
<p>
int
DBcursor-&gt;dup(DBC *DBcursor, DBC **cursorp, u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: DBcursor-&gt;dup</b>
<p>The DBcursor-&gt;dup method creates a new cursor that uses the same transaction
and locker ID as the original cursor.  This is useful when an application
is using locking and requires two or more cursors in the same thread of
control.</p>
<p>The DBcursor-&gt;dup method
returns a non-zero error value on failure
and 0 on success.
</p>
<b>Parameters</b> <br>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or by bitwise inclusively <b>OR</b>'ing together one
or more of the following values:
<br>
<b><a name="DB_POSITION">DB_POSITION</a></b><ul compact><li>The newly created cursor is initialized to refer to the same position
in the database as the original cursor (if any) and hold the same locks
(if any).  If the DB_POSITION flag is not specified, or the
original cursor does not hold a database position and locks, the created
cursor is uninitialized and will behave like a cursor newly created
using <a href="../api_c/db_cursor.html">DB-&gt;cursor</a>.</ul>
<br></ul>
<br>
<br><b>Errors</b>
<p>The DBcursor-&gt;dup method
may fail and return one of the following non-zero errors:</p>
<br>
<b>DB_REP_HANDLE_DEAD</b><ul compact><li>The database handle has been invalidated because a replication election
unrolled a committed transaction.</ul>
<br>
<br>
<b>DB_REP_LOCKOUT</b><ul compact><li>The operation was blocked by client/master synchronization.</ul>
<br>
<br>
<b>EINVAL</b><ul compact><li>An
invalid flag value or parameter was specified.</ul>
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_c/dbc_class.html">DBC</a>
<br><b>See Also</b>
<a href="../api_c/dbc_list.html">Database Cursors and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
